Skip to content

Commit e97b94c

Browse files
committed
Fix a problem where an operator such as <= on an optional type would sometimes lead to an internal compiler error. Fixes #898.
1 parent f33a9ba commit e97b94c

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

changes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Bug fixes:
2424
tuples/records containing var fields (:bugref:`919`).
2525
- Fix problem where using an iterator of variable tuple or record types could
2626
result in a segfault (:bugref:`901`).
27+
- Fix a problem where an operator such as ``<=`` on an optional type would
28+
sometimes lead to an internal compiler error (:bugref:`898`).
2729

2830
.. _v2.9.2:
2931

lib/flatten/flatten_call.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,8 @@ EE flatten_call(EnvI& env, const Ctx& input_ctx, Expression* e, VarDecl* r, VarD
971971
if (cid == c->id()) {
972972
try {
973973
auto* cr_d = env.model->matchFn(env, cr_c, false);
974-
if (cr_d != nullptr) {
974+
if (cr_d != nullptr &&
975+
!cr_d->ann().contains(env.constants.ann.mzn_internal_representation)) {
975976
decl = cr_d;
976977
}
977978
} catch (TypeError&) { /* NOLINT(bugprone-empty-catch) */
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/***
2+
!Test
3+
solvers: [gecode]
4+
expected: !Result
5+
solution: !Solution
6+
***/
7+
array[1..1] of var opt 0..10: y;
8+
constraint y = [1];
9+
constraint y[1] <= 4;

0 commit comments

Comments
 (0)